#include <stdio.h>
#include <curl/curl.h>

	size_t write_data(char *bufptr, size_t size, size_t nitems, void *userp)
	{
		printf("%s",bufptr);
		return size * nitems;
	}
int main(void)
{
	CURL *curl;
	CURLcode res;

	curl = curl_easy_init();
	if(curl) {
		
		curl_easy_setopt(curl, CURLOPT_POST, 1);  
		curl_easy_setopt(curl, CURLOPT_URL, "http://api.weixin.qq.com/messages?access_token=RaOfkV7mx9mc8QtCQwBGfl-rPKIp2Se6IIQuOAVecpgqYDgCgXz8KuADxAwh8cRaag7nOC0nSxrJEn6WF-mzb7o1Luj5RMGu6fcQx_mS_iwHmY_d-OnXrSfULPkfxUWUkAjFquzEsAzYCkq94cZ6xw" );
		curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "content=helasdf&type=text" );  
		//curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);  
		//curl_easy_setopt(curl, CURLOPT_WRITEDATA, stderr);  
		curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);  
		//curl_easy_setopt(curl, CURLOPT_HEADER, 1);  
		//curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); 
		/* Perform the request, res will get the return code */ 
		res = curl_easy_perform(curl);
		/* Check for errors */ 
		if(res != CURLE_OK)
			fprintf(stderr, "curl_easy_perform() failed: %s\n",
					curl_easy_strerror(res));

		/* always cleanup */ 
		curl_easy_cleanup(curl);
	}
	return 0;
}
